public class yang_hui {
    //杨辉三角
    public static void main(String[] args){
        int[][] yanghui = new int[10][];

        for(int i=0;i<yanghui.length;i++){
            //给每个一维数组开空间
            yanghui[i]= new int[i+1];
            //给每个一维数组赋值
            for(int j=0;j<yanghui[i].length;j++){
                //每行的第一个元素和最后一个元素都是1
                if(j==0||j==yanghui[i].length-1){
                    yanghui[i][j]=1;
                }else{
                    yanghui[i][j] = yanghui[i-1][j]+yanghui[i-1][j-1];
                }
            }
        }

        //输出结果
        for(int i=0;i< yanghui.length;i++) {
            for (int j = 0; j < yanghui.length; j++) {
                System.out.println(yanghui[i][j]);
            }
        }
    }
}